package com.library.controller;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.library.service.BookService;
import com.library.service.impl.BookServiceImpl;


@WebServlet("/deleteBook.do")
public class DeleteBookServlet extends HttpServlet {

	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		
		BookService bs = new BookServiceImpl();
		int bookId = Integer.parseInt(request.getParameter("bookId"));
		int result = bs.delBook(bookId);
		if(result == 1) {
			response.sendRedirect("showBook.do");
		}
	}

}
